// for display directories
#define MAX_PATH_SIZE 50
#define ERR_DIR_OPEN  10
#define ERR_NO_FILE 20
#define SUCCESS 0

#define PARLENGTH  20 

#define MAX_PCB_NAME 15
#define PCB_LEN sizeof(struct mpx_pcb)

#define SYST  100
#define APPL 200
#define SIZE 20


//Function Definitions
void readcmd();
void processcmd();
void mpx_exit();
void version();
void disp(char directory[]);
void help(char func[]);
void welcome();
void date(char opt[6], char dte[20]);

/**** Mod2 ********/


/* 
#define RUNNING 1000
#define READY   2000
#define BLOCKED 3000
#define SUSREADY 4000
#define SUSBLOCKED 5000
*/  

/* Type and structure definitions */
typedef struct mpx_pcb {

/* The following four members will be used in R2 */ 
char pcb_name[MAX_PCB_NAME];    /* external name */
int pcb_class;        /* type of process  */
char pcb_state[20];     /* process state */   
int pcb_priority;  /* priority  */ 


/* The following four members will be used later 
unsigned char*  pcb_memory;  
unsigned char*  pcb_resource; 
unsigned char*  pcb_context;
unsigned char*  pcb_account; 
*/ 

} PCB; 


/* Supporting function prototypes for PCB manipulation */
PCB* allo_pcb(void);
void free_pcb (PCB* p );
PCB* set_pcb(PCB* p,char name[MAX_PCB_NAME],char *cla,char* state, char *priority);



struct listNode
{
        PCB *data;
        struct listNode *nextPtr;
};

typedef struct listNode ListNode;
typedef ListNode *ListNodePtr;

struct list{
        ListNodePtr head;
        ListNodePtr tail;
};

typedef struct list List;
typedef List *ListPtr;


void queue_init(void);
void show(char *option);
void insertpcb(char *value, char *cla, char *queue, char *priority);
void removepcb(char *data, char *queue);

void insert(ListPtr sPtr, PCB* p);
int  dele(ListPtr sPtr, char *value);
int isEmpty(ListPtr sPtr);
void printList(char *queueName);
void instructions(void);
void insertfifo(ListPtr sPtr, PCB* p);

void print_pcb(PCB* p ); 
PCB* move(ListPtr sPtr, char *value);
void block (char *value );
void unblock(char *value);
void suspend(char *value);
void resume(char *value);

PCB* find(ListPtr sPtr, char *value);
PCB* findall (char *value);
int isQueue(char *option);
void setpriority(char *value, char *priority);